package cube.cubetest;
import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.MotionEvent;

public class CubeTestActivity extends Activity {
	
    private GLSurfaceView myGLSurfaceView;
    private InitCube myRenderer; //!

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        myGLSurfaceView = new GLSurfaceView(this); 
        
        myRenderer = new InitCube(false);
        myGLSurfaceView.setRenderer(myRenderer);
        //myGLSurfaceView.setRenderMode(0);
        setContentView(myGLSurfaceView);
    }
	
	@Override
	protected void onResume() { 
		//This should be run by any game when activity gains focus 
		super.onResume();
		myGLSurfaceView.onResume(); 
	}
	
	@Override 
	protected void onPause() { 
		//this should be run by any game when an activity looses focus 
		super.onPause(); 
		myGLSurfaceView.onPause();
	}
	
	@Override
	public synchronized boolean onTouchEvent(MotionEvent event) {
		if (event.getAction() == MotionEvent.ACTION_UP) {
			myRenderer.rotateTop(true);
		}
		return true;
	}
}